﻿CREATE TABLE [dbo].[Link]
(
	[LinkID] BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT [Link_Main_LinkID] PRIMARY KEY, 
	[Author] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_Author] DEFAULT ('PROMOTIONAL LINK'), 
	[AuthorFlairCssClass] NVARCHAR(250) NULL, 
	[AuthorFlairText] NVARCHAR(250) NULL, 
	[Clicked] BIT NOT NULL CONSTRAINT [Link_Main_Clicked] DEFAULT ('False'), 
	[Domain] NVARCHAR(500) NOT NULL CONSTRAINT [Link_Main_Domain] DEFAULT ('UNKNOWN'), 
	[Hidden] BIT NOT NULL CONSTRAINT [Link_Main_Hidden] DEFAULT ('False'), 
	[IsSelf] BIT NOT NULL CONSTRAINT [Link_Main_IsSelf] DEFAULT ('False'), 
	[Likes] BIT NULL, 
	[LinkFlairCssClass] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_LFCC] DEFAULT ('NONE'), 
	[LinkFlairText] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_LFT] DEFAULT ('NONE'), 
	[Media] BIGINT NULL CONSTRAINT [FK_Link_TO_Common_ON_MediaID] FOREIGN KEY ([Media]) REFERENCES [Common].[Media]([MediaID]), 
	[MediaEmbed] BIGINT NULL CONSTRAINT [FK_Link_TO_Common_ON_MediaEmbedID] FOREIGN KEY ([Media]) REFERENCES [Common].[MediaEmbed]([MediaEmbedID]), 
	[NumComments] INT NOT NULL CONSTRAINT [Link_Main_NumComments] DEFAULT (0), 
	[Over18] BIT NOT NULL CONSTRAINT [Link_Main_Over18] DEFAULT ('False'), 
	[Permalink] NVARCHAR(500) NOT NULL CONSTRAINT [Link_Main_Permalink] DEFAULT ('UNKNOWN'), 
	[Saved] BIT NOT NULL CONSTRAINT [Link_Main_Saved] DEFAULT ('False'), 
	[Score] INT NOT NULL CONSTRAINT [Link_Main_Score] DEFAULT (0), 
	[SelfText] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_SelfText] DEFAULT ('NONE'), 
	[SelfTextHTML] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_STHTML] DEFAULT ('NONE'), 
	[Subreddit] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_Subreddit] DEFAULT ('UNKNOWN'), 
	[SubredditID] NVARCHAR(250) NOT NULL CONSTRAINT [Link_Main_SubredditID] DEFAULT ('UNKNOWN'), 
	[Thumbnail] NVARCHAR(500) NOT NULL CONSTRAINT [Link_Main_Thumbnail] DEFAULT ('Self'), 
	[Title] NVARCHAR(500) NOT NULL CONSTRAINT [Link_Main_Title] DEFAULT ('UNKNOWN'), 
	[URL] NVARCHAR(500) NOT NULL CONSTRAINT [Link_Main_URL] UNIQUE, 
	[Edited] DATETIME NULL, 
	[Distinguished] NVARCHAR(100) NOT NULL CONSTRAINT [FK_Link_TO_Enum_ON_Distinguished] FOREIGN KEY ([Distinguished]) REFERENCES [Enum].[Distinguished]([Enum]), 
	[Stickied] BIT NOT NULL CONSTRAINT [Link_Main_Stickied] DEFAULT ('False')
)
